package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.AH5vipTransSub;
import com.ruoyi.system.service.IAH5vipTransSubService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 转让vip 附加Controller
 *
 * @author gf
 * @date 2024-12-12
 */
@RestController
@RequestMapping("/gf/aH5vipTransSub")
public class AH5vipTransSubController extends BaseController {
    @Autowired
    private IAH5vipTransSubService aH5vipTransSubService;

    /**
     * 查询转让vip 附加列表
     */
    @GetMapping("/list")
    public TableDataInfo list(AH5vipTransSub aH5vipTransSub) {
        startPage();
        List<AH5vipTransSub> list = aH5vipTransSubService.selectAH5vipTransSubList(aH5vipTransSub);
        return getDataTable(list);
    }

    /**
     * 导出转让vip 附加列表
     */
    @Log(title = "转让vip 附加", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AH5vipTransSub aH5vipTransSub) {
        List<AH5vipTransSub> list = aH5vipTransSubService.selectAH5vipTransSubList(aH5vipTransSub);
        ExcelUtil<AH5vipTransSub> util = new ExcelUtil<>(AH5vipTransSub.class);
        util.exportExcel(response, list, "转让vip 附加数据");
    }

    /**
     * 获取转让vip 附加详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(aH5vipTransSubService.selectAH5vipTransSubById(id));
    }

    /**
     * 新增转让vip 附加
     */
    @Log(title = "转让vip 附加", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AH5vipTransSub aH5vipTransSub) {
        return toAjax(aH5vipTransSubService.insertAH5vipTransSub(aH5vipTransSub));
    }

    /**
     * 修改转让vip 附加
     */
    @Log(title = "转让vip 附加", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AH5vipTransSub aH5vipTransSub) {
        return toAjax(aH5vipTransSubService.updateAH5vipTransSub(aH5vipTransSub));
    }

    /**
     * 删除转让vip 附加
     */
    @Log(title = "转让vip 附加", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(aH5vipTransSubService.deleteAH5vipTransSubByIds(ids));
    }

    /**
     * 逻辑删除转让vip 附加
     */
    @Log(title = "转让vip 附加", businessType = BusinessType.DELETE)
    @DeleteMapping("/logicDel/{ids}")
    public AjaxResult logicDel(@PathVariable Long[] ids) {
        return toAjax(aH5vipTransSubService.deleteAH5vipTransSubByIds(ids));
    }

}
